<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="andreas08.css" type="text/css" media="screen,projection" />
<script type="text/javascript" src="/js/page.js"></script>
<script type="text/javascript">
function new_work(id){
	var newwin = window.open_centered("dettaglio_lavoro.php?_i="+id, "news", 650, 600, "");
}
</script>
<title>Intranet Docenti</title>

</head>
<body>
<div id="container" >

<div id="header">
<h1>Scuola Media E. d'Arborea - Lamarmora</h1>
<h2>area riservata ai docenti</h2>
</div>

<?php include "navigation.php" ?>
<div id="content">
<h2 style="text-align: center">Lavori dei ragazzi</h2>
<?php
if(!isset($_GET['l2'])){
?>
<form method="post" action="lavori_studenti.php?l2=1">
<table style="margin: auto; width: 80%">
	<tr style="font-weight: bold;">
		<td style="color: #003366;width: 50%">Anno scolastico</td>
		<td style="width: 50%">
		<select name="anno" style="width: 200px; border: 1px solid; font-size: 11px">
			<option selected="selected" value="all">Tutti</option>
			<?php
			while($row = $res_anni->fetch_assoc()){
			?>
			<option value="<?php print $row['anno'] ?>"><?php print $row['anno'] ?></option>
			<?php } ?>
		</select>
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr style="font-weight: bold;">
		<td style="color: #003366;width: 50%">Classe</td>
		<td style="width: 50%">
		<select name="classe" style="width: 200px; border: 1px solid; font-size: 11px">
			<option selected="selected" value="all">Tutte</option>
			<?php
			while($cls = $res_classi->fetch_assoc()){
			?>
			<option value="<?php print $cls['classe'].$cls['sezione'] ?>"><?php print $cls['classe']." ".$cls['sezione'] ?></option>
			<?php } ?>
		</select>
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr style="font-weight: bold;">
		<td style="color: #003366;width: 50%">Studente</td>
		<td style="width: 50%">
		<input type="text" name="studente" style="width: 200px; border: 1px solid; font-size: 11px" />
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr style="font-weight: bold;">
		<td style="color: #003366;width: 50%">Docente</td>
		<td style="width: 50%">
		<input type="text" name="docente" style="width: 200px; border: 1px solid; font-size: 11px" />
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr style="font-weight: bold;">
		<td style="color: #003366;width: 50%">Ordina per...</td>
		<td style="width: 50%">
		<select name="order" style="width: 200px; border: 1px solid; font-size: 11px">
			<option selected="selected" value="1">Anno scolastico</option>
			<option value="2">Classe</option>
			<option value="3">Studente</option>
			<option value="4">Docente</option>
		</select>
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
	<td colspan="2" align="right" style="padding-right: 10px">
		<a href="#" onclick="javascript: document.forms[0].submit()">Cerca file</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="index.php">Torna al men&ugrave;</a>
	</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
</table>
</form>
<?php
}
else{ 
?>
<form method="post" action="students_works.php?l2=1">
<table style="margin: auto; width: 100%">
	<tr style="font-weight: bold;">
		<td style="width: 45%">Autore</td>
		<td style="width: 40%">Titolo</td>
		<td style="width: 15%"></td>
	</tr>
<?php
	$x = 1; // contatore grafico
    if($files->num_rows > $limit)
    	$max = $limit;
    else
    	$max = $files->num_rows;
	
	while($row = $files->fetch_assoc()){
		if($x > $limit) break;
		$file = ereg_replace("/", "_", $row['anno'])."/".$row['file'];
		if($x%2)
			$bg = "background-color: rgb(247,247,250)";
		else
			$bg = "";
		$year = substr($row['anno'], 2, 2)."/".substr($row['anno'], 7, 2);
?>
	<tr style="font-weight: normal: border: 0px">
		<td class="elenco" style="width: 45%; <?php print $bg ?>"><a title="<?php print $row['abstract'] ?>" style="font-weight: normal" href="/get_file.php?dt=1&id=<?php print $row['id_work'] ?>&f=<?php print $file ?>"><?php print $row['autore'] ?></a></td>
		<td class="elenco" style="width: 40%; <?php print $bg ?>"><a title="<?php print $row['abstract'] ?>" style="font-weight: normal" href="/get_file.php?dt=1&id=<?php print $row['id_work'] ?>&f=<?php print $file ?>"><?php print $row['titolo'] ?></a></td>
		<td class="elenco" style="width: 15%; <?php print $bg ?>; text-align: center"><a title="<?php print $row['abstract'] ?>" style="font-weight: normal" href="/get_file.php?dt=1&id=<?php print $row['id_work'] ?>&f=<?php print $file ?>"><?php print $row['classe']." &nbsp;&nbsp;".$year ?></a></td>
	</tr>
	<?php 
                $x++;
            }
            include $_SERVER['DOCUMENT_ROOT']."/shared/navigate.php";
            ?>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td>		
		<input type="hidden" name="anno" value="<?php print $_REQUEST['anno'] ?>"/>
		<input type="hidden" name="classe" value="<?php print $_REQUEST['classe'] ?>"/>
		<input type="hidden" name="studente" value="<?php print $_REQUEST['studente'] ?>"/>
		<input type="hidden" name="docente" value="<?php print $_REQUEST['docente'] ?>"/>
		<input type="hidden" name="order" value="<?php print $_REQUEST['order'] ?>"/>
		<input type="hidden" name="second" value="1"/>
		<input type="hidden" name="offset"/>		
		</td>
	</tr>
</table>
</form>
<?php
}
?>
</div>
<div id="subcontent">
<?php include "menu_docs.php" ?>
</div>

<?php include "footer.php" ?>

</div>
</body>    
</html>